#include "object.h"

Object::Object()
{
    m_visible = true;
    m_wireframe = true;
    m_solid = true;
    x_sc = 1.0;
    y_sc = 1.0;
    z_sc = 1.0;
    x_tr = 0.0;
    y_tr = 0.0;
    z_tr = 0.0;
    x_rot = 0.0;
    y_rot = 0.0;
    z_rot = 0.0;
}

Primitive* Object::get_primitive()
{
    return m_primitive;
}

void Object::set_primitive(Primitive *primitive)
{
    m_primitive = primitive;
}

void Object::update(glm::vec4 position, float attr1, float attr2, float attr3)
{
    //m_origin = position;
    //m_attr = attr;
    Sphere *sphere;
    Box *cube;
    switch(m_primitive->type){
    case SpherePrimitive:
        sphere = dynamic_cast<Sphere*>(m_primitive);
        sphere->m_origin = position;
        sphere->m_radius = attr1;
        break;
    case BoxPrimitive:
        cube = dynamic_cast<Box*>(m_primitive);
        cube->m_origin = position;
        cube->m_side = attr1;

        break;
    default:
        break;
    }
}

void Object::set_visible(bool visible){
    m_visible = visible;
}

void Object::set_wireframe(bool wireframe){
    m_wireframe = wireframe;
}

void Object::set_solid(bool solid){
    m_solid = solid;
}

bool Object::is_visible(){
    return m_visible;
}

bool Object::wireframe(){
    return m_wireframe;
}

bool Object::solid(){
    return m_solid;
}


